﻿function DataAnnotationsValidatorIsValid(val) {
	var functionsToEvaluate = val.validatorFunctions.split(';;');
	var errorMessages = val.errorMessages.split(';;');

	for (var funcIndex in functionsToEvaluate) {
		var result = eval(functionsToEvaluate[funcIndex] + "(val)");
		if (result === false) {
			val.errormessage = errorMessages[funcIndex];
			if (val.supressErrorMessageText === "false") {
				val.innerHTML = errorMessages[funcIndex];
			}
			return false;
		}
	}
	return true;
}

function StringLengthValidatorEvaluateIsValid(val) {
	var value = ValidatorTrim(ValidatorGetValue(val.controltovalidate));
	if (value.length >= parseInt(val.minlength) && (value.length <= parseInt(val.maxlength) || parseInt(val.maxlength) === 0))
		return true;

	return false;
}